package org.railage.server.services;

import org.railage.common.dto.UserDTO;
import org.railage.server.dao.UserDAO;
import org.railage.server.dao.UserDAOImpl;
import org.railage.server.entities.User;

public class UserService {
	
	private UserDAO userDAO = new UserDAOImpl();

	public UserDTO authenticate(Object obj) {
		String[] userdata = (String[]) obj;
		User user = userDAO.getUserByLoginPassword(userdata[0], userdata[1]);
		if (user == null) {
			return null;
		} else {
			return user.toDTO();
		}
	}

}
